<template>
  <el-dialog
    v-el-drag-dialog
    title="催单次数"
    :visible.sync="visible"
    width="600px"
  >
    <el-timeline :reverse="false" style="margin-top: 30px;">
      <el-timeline-item
        v-for="(activity, index) in activities"
        :key="index"
        :timestamp="moment(activity.happentDt).format('YYYY-MM-DD HH:mm')"
      >
        {{ activity.regUser }}&emsp;催单一次&emsp;{{ `理由：${activity.remark}` }}&emsp;{{ activity.comeFrom === 1 ? '手动催单' : '系统催单' }}
      </el-timeline-item>
    </el-timeline>
  </el-dialog>
</template>

<script>

  import { queryUrgeRecordList } from '@/api'
  import moment from 'dayjs'

  export default {
    name: 'press-order-report',
    data() {
      return {
        moment,
        visible: false,
        activities: []
      }
    },
    methods: {
      open(temp) {
        this.getUrgeRecordList(temp)
        return new Promise(resolve => {
          this.resolve = resolve
          this.visible = true
        })
      },
      // 查询催单记录
      async getUrgeRecordList(temp) {
        const res = await queryUrgeRecordList({
          billCode: temp.billCode,
          billType: temp.billType
        })
        this.activities = JSON.parse(res.data.urgebillList)
      }
    }
  }
</script>

<style scoped>

</style>
